import Data from './http.js';
let {
	uploadFile,
	http
} = Data

let rooturl = 'http://zhongao.ruisi.me';

let ApiUrl = {
	mypay: '/mypay/pay',
	address:'/user/address',
	get_trace:'/order/get_trace'
	
}

// 获取首页商品值
export function delproduct(data,token) {
	console.log('请求参数', data)
	return http({
		url:rooturl + ApiUrl.mypay,
		method: 'post',
		// data,
		header: {
			"Content-Type": "application/x-www-form-urlencoded",
			"Authorization": "Bearer " + token
		}
	})
}

					// url: this.$serverUrl+'/my_first_message',
	
 // this.$serverUrl+'/goods/lists'	

export function getGoodList(){
	return http({
		url: rooturl  +'/goods/lists',
		method:'GET',
		header: {
			"Content-Type": "application/x-www-form-urlencoded",
		}
	})
}			 

export function getMessage(){
	return http({
		url: rooturl + '/my_first_message',
		method:'GET',
		header: {
			"Content-Type": "application/x-www-form-urlencoded",
		}
	})
}
/**
  	退出登录
  	方法 	post
	参数					user_id:this.$store.state.user_id,
						token:this.$store.state.token
 * */
export function userOut(data) {
	console.log('请求参数', data)
	return http({
		url: rooturl + '/user/logout',
		method: 'post',
		data,
		header: {
			"Content-Type": "application/x-www-form-urlencoded",
		}
	})
}
/**
  	修改昵称
  	方法 	post
	参数					user_id:this.$store.state.user_id,
						token:this.$store.state.token,
						renickname:this.uname
 * */
export function updateName(data) {
	console.log('请求参数', data)
	return http({
		url: rooturl + 	'/user/renickname',
		method: 'post',
		data,
		header: {
			"Content-Type": "application/x-www-form-urlencoded",
		}
	})
}
/**
  	修改密码
  	方法 	post
	参数					user_id:this.$store.state.user_id,
						token:this.$store.state.token,
						pwd:this.upwd,
						new_pwd:this.upwds,
						username:uname
 * */
export function updatepwd(data) {
	console.log('请求参数', data)
	return http({
		url: rooturl + '/user/updatepwd',
		method: 'post',
		data,
		header: {
			"Content-Type": "application/x-www-form-urlencoded",
		}
	})
}
/**
  	获取获取订单号
  	方法 	get
	参数					user_id:this.$store.state.user_id,
						token:this.$store.state.token,
						order_id:JSON.stringify(list),
 * */
export function getTrace(data) {
	console.log('请求参数', data)
	return http({
		url: rooturl + ApiUrl.get_trace,
		method: 'post',
		data,
		header: {
			"Content-Type": "application/x-www-form-urlencoded",
		}
	})
}
/**
  	获取收货功能地址
  	方法 	get
	参数		user_id   用户id
			token	  登录token
 * */
export function getAdress(data) {
	console.log('请求参数', data)
	return http({
		url: rooturl + ApiUrl.address,
		method: 'get',
		data,
		header: {
			"Content-Type": "application/x-www-form-urlencoded",
		}
	})
}



export function uodateApp(data, token) {
	console.log('请求参数', data)
	if (token) {
		return http({
			url: `${ApiUrl.upgrade.uodateApp}`,
			method: 'post',
			data,
			header: {
				"Content-Type": "application/x-www-form-urlencoded",
				"Authorization": "Bearer " + token
			}
		})
	} else {
		return http({
			url: `${ApiUrl.upgrade.uodateApp}`,
			method: 'post',
			data,
			header: {
				"Content-Type": "application/x-www-form-urlencoded",
			}
		})
	}

}